/* Export concrete files to .csv format. */

%include "ASMimplibs.sas";


/** Export the 2002 concrete files. **/


 data concrete02_gooddata ; 
  set concrete.concrete_0207_gooddata;
 if year=2002;
 run;

 /* Save the survu_id's  for re-merging after CART imputes. */
 data concrete.concrete02_gooddata_ids (keep = number survu_id firmid wt);
  set concrete02_gooddata;
  number = _N_;
 run;

data concrete02_gooddata (keep =  tvs cm energy tab02 sw nonpw ph ww pw CEA_ddensity BEA_CEA_Code);
 set concrete02_gooddata;
run;



PROC EXPORT DATA= concrete02_gooddata 
 OUTFILE= "concrete_gooddata02.csv" 
 DBMS=CSV REPLACE;
 PUTNAMES=YES;
RUN;


/** Export the 2007 concrete files. **/


 data concrete07_gooddata ; 
  set concrete.concrete_0207_gooddata;
 if year=2007;
 run;

 /* Save the survu_id's for re-merging after CART imputes. */
 data concrete.concrete07_gooddata_ids (keep = number survu_id firmid wt);
  set concrete07_gooddata;
  number = _N_;
 run;

data concrete07_gooddata (keep = tvs cm energy tab07 sw nonpw ph ww pw CEA_ddensity BEA_CEA_Code);
 set concrete07_gooddata;
run;


PROC EXPORT DATA= concrete07_gooddata 
 OUTFILE= "concrete_gooddata07.csv" 
            DBMS=CSV REPLACE;
     PUTNAMES=YES;
RUN;


